<template>
    <h2>用户理财赎回</h2>
    理财名称:<input type="text" v-model="F_Name">
    <input type="button" @click="Show" value="查询">
    <table>
        <thead>
            <tr>
                <td>理财编号</td>
                <td>理财名称</td>
                <td>年收益</td>
                <td>月收益</td>
                <td>最低金额</td>
                <td>风险等级</td>
                <td>操作</td>
            </tr>
        </thead>
        <tbody>
            <tr v-for="item in data" :key="item.F_Id">
                <td>{{ item.F_Id }}</td>
                <td>{{ item.F_Name }}</td>
                <td>{{ item.F_Year }}</td>
                <td>{{ (item.F_Year / 12).toFixed(2) }}</td>
                <td>{{ item.F_Min }}</td>
                <td>{{ item.F_Level }}</td>

                <td><input type="button" @click="User(item.F_Id)" value="理财赎回"></td>
            </tr>
        </tbody>
    </table>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import axios from 'axios';
import { useRouter } from 'vue-router';
import { onMounted } from 'vue';
const data = ref([{
    F_Id: 0,
    F_Name: '',
    F_Year: 0,
    F_Min: 0,
    F_Level: 0,

}])
const F_Name = ref('');
onMounted(() => {
    Show();
})
const Show = () => {
    axios.get('http://localhost:57910/api/Demo/Inserset', {
        params: {
            F_Name: F_Name.value
        }
    })
        .then(res => {
            data.value = res.data
        })
}
const router = useRouter();
const User = (F_Id: number) => {
    router.push({
        name: 'UserInAwait',
        params: {
            F_Id: F_Id
        }
    })
}

</script>